﻿@model AFT.Parking.Entity.ParkingAreaShare

@{
    ViewBag.Title = "编辑停车区";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<div class="content-box">
    <div class="content-box-header">
        <h3>编辑停车区域信息</h3>
    </div>
    <div class="content-box-content">
        <div class="tab-content default-tab" id="tab2">
            <form method="post" id="frm">
                <fieldset>
                    @Html.HiddenFor(m => m.ParkingAreaId)
                    <p>
                        <label>停车区</label>
                        <span>@ViewBag.ParkingAreaName</span>
                    </p>
                    <p>
                        <label>区域名称</label>
                        @Html.TextBoxFor(m => m.ShareName, new { @class = "text-input small-input" })
                    </p>
                    <p>
                        <div>
                            <label>区域图片</label>
                            <div style="margin-bottom: 10px"><a id="uploadBtn" href="javascript:void(0);" class="button">上传图片</a></div>
                            <img id="img" src="@Model.HighlightImg" style="width: 240px; height: 180px;" />
                            @Html.Hidden("HighlightImg", @Model.HighlightImg);
                        </div>
                    </p>
                    <script type="text/javascript">
                        new AjaxUpload($("#uploadBtn"), {
                            action: "/ParkingCamera/FileUploadFile",
                            data: {
                                folderName: "AreaShares"
                            },
                            name: 'UploadImg',
                            responseType: "json",
                            onSubmit: function (file, extension) {
                            },
                            onComplete: function (file, data) {
                                console.log(data);
                                if (data.Value) {
                                    $("#img").attr("src", data.Result[0]);
                                    $("#HighlightImg").val(data.Result[0]);
                                }
                                else {
                                    alert("上传失败。");
                                }
                            }
                        })
                    </script>
                    <p>
                        <input class="button" type="submit" id="btnSubmit" value=" 保 存 " />
                        <input class="button" type="button" id="btnBack" value=" 返 回 " />
                        <input type="hidden" id="hd_backUrl" value="@Url.Action("Areas","ParkingAreas")">
                    </p>
                </fieldset>
                <div class="clear"></div>
            </form>

        </div>
    </div>
</div>
